package com.zlc.common.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.zlc.common.util.DateUtils;

import java.io.IOException;
import java.util.Date;


public class JsonDateSerializer extends JsonSerializer<Date> {

    @Override
    public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeString( DateUtils.parse((Date) date,"yyyy-MM-dd HH:mm:ss"));
    }
}